package com.chenxin.transaction.service.impl;

import com.chenxin.transaction.dao.AccountInfoDao;
import com.chenxin.transaction.service.AccountInfoService;
import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Slf4j
public class AccountInfoServiceImpl implements AccountInfoService {

    @Autowired
    private AccountInfoDao accountInfoDao;

    /**
     * 李四到账
     *
     * @param accountNo
     * @param amount
     */
    @Transactional
    public void updateAccountBalance(String accountNo, Double amount) {
        log.info("bank2 service begin,XID：{}", RootContext.getXID());
        //李四增加金额
        accountInfoDao.updateAccountBalance(accountNo, amount);
    }
}
